﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddProducts.aspx.cs" Inherits="TotalSport.AddProducts"
    Theme="default" %>

<%@ Register Src="~/Header.ascx" TagName="header" TagPrefix="uc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>:: Add Products::</title>
    <link href="Styles/Stylsheet.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="Scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            // Tabs
            $('#tabs').tabs({ selected: 0 });
            $('#tabs').bind('tabsshow', function (event, ui) {
                var tabSelected = "#tab" + ui.index + "Selected";
                $(tabSelected).html("isClicked");
            });

            $('#aa_lnkAddproudct').css({ color: '#FF0001' });


        });
    </script>
    <script type="text/javascript">
        function textboxMultilineMaxNumber(txt, maxLen) {
            try {
                if (txt.value.length > (maxLen - 1)) return false;
            } catch (e) {
            }
        }

        function selectName() {
            var nameddl = document.getElementById("ddlParticularName");
            var nametxt = document.getElementById("txtParticularName");
            // alert(nameddl.value)
            if (nameddl.value == "-1") {
                nametxt.style.display = "block";
            }
            else {

                nametxt.style.display = "none";
            }
        }

        function Count(x) {
            var length = document.getElementById("txtDescription").value.length;
            //            if (length <= 1500) {
            document.getElementById("lblcount").innerHTML = length;
            //            }
            //            else {
            //                document.getElementById("lblcount").innerHTML = "Please,Enter Only 1500 characters"
            //                
            //            }
        }



        function Disable() {

            var Category = document.getElementById("ddlCategory");
            var SubCategory = document.getElementById("ddlsubCategory");
            var PName = document.getElementById("ddlParticularName");
            var linkAdd = document.getElementById("lnkAdd");
            var Pnametxt = document.getElementById("txtParticularName");
            // alert(linkAdd.text);
            if (linkAdd.text == "Add More Items") {
                Category.disabled = true;
                SubCategory.disabled = true;
                PName.disabled = true;

                Pnametxt.disabled = true;
                linkAdd.innerHTML = "Done";


            }
            else {

                Category.disabled = false;
                SubCategory.disabled = false;
                PName.disabled = false;
                Pnametxt.disabled = false;
                linkAdd.innerHTML = "Add More Items";
            }


            // ddlCategory.Enabled = false;
            // ddlParticularName.Enabled = false;
            //lnkAdd.Text = "Done";
            //if (ddlParticularName.SelectedValue == "-1")
            //{ 
            //    txtParticularName.Visible = true;
            //    txtParticularName.Enabled = false; }




        }




        function isNumberKey(evt) {
            var charCode = (evt.which) ? evt.which : event.keyCode
            if (charCode > 31 && (charCode < 48 || charCode > 57))
                return false;
        }


        function focused() {
            //  alert('');

            var aaa = document.getElementById("spnMsg");
            // alert(aaa);
            aaa.style.display = "none";
            //aaa.inn = "iii";
        }


    </script>
</head>
<body>
    <form id="form1" runat="server">
    <center>
        <div>
            <uc:header runat="server" ID="aa" />
        </div>
        <fieldset style="width: 700px; color: #054287; text-align: left">
            <legend>Add Product</legend>
            <table border="0" cellpadding="3" cellspacing="5" width="600px">
                <tr>
                    <td colspan="2">
                        <span id="spnMsg" class="spanMsgs" style="display: none" runat="server"></span>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Category :
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlCategory" runat="server" OnInit="ddlCategory_Init" AutoPostBack="true"
                            onfocus="focused()" OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged">
                            <%-- <asp:ListItem Selected="True">Indoor</asp:ListItem>
                            <asp:ListItem>Outdoor</asp:ListItem>--%>
                        </asp:DropDownList>
                        <span id="spncategory" runat="server" class="validators" style="display: none"></span>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        SubCategory :
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlsubCategory" runat="server" onfocus="focused()" AppendDataBoundItems="True"
                            AutoPostBack="True" OnSelectedIndexChanged="ddlsubCategory_SelectedIndexChanged">
                            <%--   <asp:ListItem Selected="True">Fitness</asp:ListItem>
                            <asp:ListItem>Game</asp:ListItem>--%>
                        </asp:DropDownList>
                        <span id="spnSubcategory" runat="server" class="validators" style="display: none">
                        </span>
                    </td>
                </tr>
                <tr>
                    <td align="right" width="150px">
                        Particulars Name :
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlParticularName" runat="server" onchange="selectName();"
                            onfocus="focused()" 
                            onselectedindexchanged="ddlParticularName_SelectedIndexChanged" >
                            <%-- onselectedindexchanged="ddlParticularName_SelectedIndexChanged">--%>
                            <%--  <asp:ListItem Selected="True">Commercial Recumbent Bike.</asp:ListItem>
                            <asp:ListItem>Magnetic bike</asp:ListItem>
                            <asp:ListItem Value="-1">Other</asp:ListItem>--%>
                        </asp:DropDownList>
                        <span id="spnParticularNm" runat="server" class="validators" style="display: none">
                        </span>
                    </td>
<%--                    <td>
                        <asp:TextBox ID="txtParticularName" SkinID="addmore" runat="server" MaxLength="150"
                            onfocus="focused()"></asp:TextBox>
                    </td>--%>
                </tr>
                <tr>
                    <td align="right" valign="top">
                        Brand Name :
                    </td>
                    <td>
                        <asp:TextBox ID="txtBrandName" runat="server" MaxLength="50" onfocus="focused()"></asp:TextBox><br />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please , Enter Brand Name"
                            ControlToValidate="txtBrandName" SetFocusOnError="true" CssClass="validators "></asp:RequiredFieldValidator>
                    </td>
                    <td width="150px" align="left">
                        <%-- <asp:LinkButton ID="lnkAdd" runat="server" OnClientClick ="Disable();"  CausesValidation="false" >Add More Items</asp:LinkButton>--%>
                        <a href="#" onclick="Disable();" id="lnkAdd" runat="server" style="display: none">Add
                            More Items</a>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Item Code :
                    </td>
                    <td>
                        <asp:TextBox ID="txtItemCode" runat="server" MaxLength="10"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Add Size
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlsize" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Add VAT
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlvat" runat="server" SkinID="VAT">
                            <asp:ListItem Selected="True" Text="0">
                            </asp:ListItem>
                            <asp:ListItem Text="5">
                            </asp:ListItem>
                            <asp:ListItem Text="12.5"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:Label ID="Label1" runat="server" Text="%"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Select Pic(Small) :
                    </td>
                    <td width="100px" colspan="2">
                        <asp:FileUpload ID="FUpload" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Select Pic(Large) :
                    </td>
                    <td width="100px" colspan="2">
                        <asp:FileUpload ID="FUploadLarge" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Price :
                    </td>
                    <td>
                        <asp:TextBox ID="txtPrice" runat="server" onkeypress="return isNumberKey(event)"
                            MaxLength="10"></asp:TextBox><br />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please , Enter Price"
                            ControlToValidate="txtPrice" SetFocusOnError="true" CssClass="validators "></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top">
                        Description :
                    </td>
                    <td colspan="2">
                        <asp:TextBox SkinID="description" ID="txtDescription" runat="server" Height="112px"
                            TextMode="MultiLine" Width="259px" MaxLength="1500" onkeyup="Count(this.id)"
                            onkeypress="return textboxMultilineMaxNumber(this,1500);"></asp:TextBox>
                        <br />
                        <asp:Label ID="lblcount" runat="server" Text="Maximum 1500  Characters allowed" Style="color: Red"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        <asp:Button ID="btnSubmit" runat="server" Text="Save" OnClick="btnSubmit_Click" Style="height: 26px" />
                        <asp:Label ID="lblhiddentxt" runat="server" Text="Label" Visible="false"></asp:Label>
                    </td>
                </tr>
            </table>
        </fieldset>
    </center>
    </form>
</body>
</html>
